﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 多态练习
{
    class Animal
    {
        virtual public void shout()
        {
            Console.WriteLine("Animal");
        }
    }
    class Pet : Animal
    {
        override public void shout()
        {
            Console.WriteLine("Pet");
        }
    }
    class Dog : Pet
    {
        public override void shout()
        {
            Console.WriteLine("Dog");
        }
    }
    internal class Program
    {
        static void Main(string[] args)
        {
            Animal dog = new Dog();
            dog.shout();

            Console.Read();
        }
    }
}
